/**
 * @param {number} n
 * @param {number[][]} logs
 * @return {number}
 */
var hardestWorker = function (n, logs) {
  let maxID = '',maxTime = 0
  maxID=logs[0][0]
  maxTime=logs[0][1]
  for(let i=1;i<logs.length;i++){
    const time = logs[i][1]-logs[i-1][1]
    if(time>maxTime){
      maxTime=time
      maxID=logs[i][0]
    }
  }

  return maxID
};